<?php
/**
 * @version		$Id: default.php 21837 2011-07-12 18:12:35Z dextercowley $
 * @package		Joomla.Administrator
 * @subpackage	com_templates
 * @copyright	Copyright (C) 2005 - 2011 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 */
// No direct access.
defined('_JEXEC') or die;

// Include the component HTML helpers.
//JHtml::addIncludePath(JPATH_COMPONENT.'/helpers/html');
//JHtml::_('behavior.tooltip');
//JHtml::_('behavior.multiselect');

//$user		= JFactory::getUser();
$listOrder	= $this->escape($this->state->get('list.ordering'));
$listDirn	= $this->escape($this->state->get('list.direction'));
?>
<script>
$(document).ready(function() {
	$(".product").mouseover(function() {		
		$("#"+this.id).css('border','1px solid #8B6F47');
	});
	$(".product").mouseout(function() {		
		$("#"+this.id).css('border','1px solid #E8E8E8');
	});
});
</script>
<form action="<?php echo JRoute::_('index.php?option=com_products'); ?>#filter-bar" method="post" name="adminForm" id="adminForm">
	<fieldset id="filter-bar">
		<div class="filter-search fltlft">
			<label class="filter-search-lbl" for="filter_search">名称：</label>
			<input type="text" name="filter_search" id="filter_search" value="<?php echo $this->escape($this->state->get('filter.search')); ?>" title="输入名称查询" />
			<label class="filter-search-lbl" for="filter_type_id">类别：</label>
			<select name='type_id' id="type_id" title='产品类型'>
			<option value=''>所有类型</option>
			<?php foreach ($this->product_types as $key=>$val){?>
			<option value='<?php echo $val->id;?>' <?php if ($this->escape($this->state->get('filter.type_id'))==$val->id){echo 'selected';} ?>><?php echo $val->name;?></option>
			<?php }?>
			</select>
			<button type="submit"><?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?></button>
			<button type="button" onclick="document.id('filter_search').value='';document.id('type_id').value='';this.form.submit();">显示全部</button>
		</div>
	</fieldset>
	<div class="clr"> </div>
	<?php if($this->items){
	?>
	<table border=0 width=100% id='products_list_page'>
		<?php 
		foreach ($this->items as $i => $item){
			$detail_url=JRoute::_("index.php?option=com_products&view=product&layout=view&id=".$item->id."&Itemid=467#main_content");
			if($i%3==0){
				echo "<tr>";
			}
			echo "<td>";
		?>
		<div class='product' id='pro_<?php echo $item->id;?>' style=''>		
			<table>
				<tr>
					<td>
						<div class="dropshadow2">
							<div class="innerbox">
								<a href='<?php echo $detail_url;?>'>
								<?php 	
									$img='';
									$img.=COM_MEDIA_BASEURL.($item->thumbnail?$item->thumbnail:'default.jpg');
									echo "<img src='$img' border='0' title='点击查看\"".$item->name."\"详情'/>";
								?>			
								</a>
							</div>
						</div>
					</td>
				</tr>
				<tr>
					<td>
						<div class='product_name'><a href='<?php echo $detail_url;?>'><?php echo $item->name;?></a></div>
					</td>
				</tr>
				<tr>
					<td>
						<div class='product_price'>价格：<?php echo $item->price!='0.00'?$item->price.'￥':'未确认';?></div>
						<div class='product_num'>数量：<?php echo $item->number!=0?$item->number:'未确认';?></div>
					</td>
				</tr>
			</table>			
		</div>
		<?php 	
			echo "</td>";
			
			if($i%3==2){
				echo "</tr>";
			}
			$i++;
		}
		if ($i%3==1){			
				echo "<td></td><td></td></tr></table>";
		}elseif($i%3==2){
				echo "<td></td></tr></table>";
		}
		?>
		
	</table>
	<?php
	}else{
	?>
	<font color='red'>很抱歉，没有搜索到你需要的植株！<br/>您可以点击“显示全部”浏览查看！</font>
	<?php 	
	}?>
	<br/>
	<br/>
	<?php echo $this->pagination->getListFooter(); ?>
	<br/>
	<br/>
	<div>
		<input type="hidden" name="task" value="" />
		<input type="hidden" name="boxchecked" value="0" />
		<input type="hidden" name="filter_order" value="<?php echo $listOrder; ?>" />
		<input type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
		<?php echo JHtml::_('form.token'); ?>
	</div>
</form>
